


import  requests
import json

#访问码云的URL
url = 'https://api.github.com/search/repositories?q=language:python&sort=stars'
r = requests.get(url)
print("Status Code:",r.status_code)

#将返回的信息存储到字典中
reponse_dict = r.json()
#reponse_dict = r.content.decode()


for key in reponse_dict.keys():
    print(key)

#打印返回的每个项目的部分属性：
reponse_items = reponse_dict['items']
for item in reponse_items:
    print('\nid:',item['id'])
    print('name:',item['name'])
    print('has_wiki:',item['has_wiki'])
    print("stargazers_count:",item["stargazers_count"])
    
''''
------------------------输出----------------------------
Status Code: 200
total_count
incomplete_results
items

id: 21289110
name: awesome-python
has_wiki: False
stargazers_count 56498

id: 83222441
name: system-design-primer
has_wiki: True
stargazers_count 50637

id: 51117837
name: models
has_wiki: True
stargazers_count 43078
''''